// 购物车
import { get, post } from '@/server/http';
import request from '@/server/request'; // 直接引入 instance

// 购物车列表
export const getCartListAPI = params => {
  return get('cartlist', params);
};
// 购物车数量++
export const addCartNumAPI = params => {
  return post('cartedit', params);
};
// 购物车数量--
export const minusCartNumAPI = params => {
  return post('cartedit', params);
};

//地址列表请求
export const getAddressListAPI = params => {
  return get('addresslist', params);
};
// 订单提交 支付

export const orderSubmitAPI = params => {
  return request({
    method: 'post',
    url: 'orderadd',
    data: params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
};
// 确定支付
export const orderPayAPI = params => {
  return request({
    method: 'post',
    url: 'alipay',
    data: params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
};
// 新增收获地址
export const addAddressAPI = params => {
  return request({
    method: 'post',
    url: 'addressadd',
    data: params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
};
// 删除购物车

export const deleteCartAPI = params => {
  return post('cartdelete', params);
};
// 添加编辑地址
export const editAddressAPI = params => {
  return post('addressedit', params);
};
// 删除收获地址
export const deleteAddressAPI = params => {
  return post('addressremove', params);
};
